using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using ECommerce.Library.Web;
using eShop.Business;
using eShop.Model;
using eShop.Business;

public partial class master_admin : BaseMaster
{
   

    protected void Page_Load(object sender, EventArgs e)
    {
        

        if (!IsPostBack)
        {
            //Page.Header.DataBind();
            if (SiteMap.CurrentNode!= null)
            {
                litPageTitle.Text = SiteMap.CurrentNode.Description;
            }
            LoadSiteUser();
        }
    }

    protected void LoadSiteUser()
    {
        try
        {
            if (SessionManager.IsAdminUserLoggedIn)
            {
                User siteUser = SessionManager.LoggedAdminUser;
                lblWelcomeName.Text = "Admin USER";
                lkbLogout.Visible = true;            
            }
            else
            {
                throw new Exception();
            }
        }
        catch
        {
            lblWelcomeName.Text = "GUEST USER";
            lkbLogout.Visible = false;
            
        }
    }
    protected void lkbLogout_Click(object sender, EventArgs e)
    {
        if (UserManager.Logout(UserLocationType.BackEnd))
        {
            LoadSiteUser();
            Response.Redirect(eShop.Business.CustomSiteMap.AdminLogin);
        }
    }
}
